home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Franz PD / Franz PD Disk #001 (19xx)(Amiga User Group Deutschland e.V.).zip / Franz PD Disk #001 (19xx)(Amiga User Group Deutschland e.V.).adf / YachtC / yachtc.c < prev    next >
C/C++ Source or Header  |  1986-10-22  |  32KB  |  1,193 lines

  1. /***********************************************************************
  2. *
  3. *                           Yachtc
  4. *             Yes, Friends, it My First Amiga Program
  5. *             Copyright 1985 by Sheldon Leemon
  6. *             Feel free to copy and distribute the program and
  7. *             source code, but don't try to sell, license, or
  8. *             otherwise commercially exploit it.
  9. *
  10. *             If you have questions or comments, you may contact
  11. *             the author through Delphi (username = DRX)
  12. *             or Compuserve ID 72705,1355.  No late-night phone calls,
  13. *             please. 
  14. *
  15. ************************************************************************/
  16.  
  17. /* These dummy declarations of structs that are not used are
  18.    here to keep the compiler from complaining.  Obviously, if your
  19.    program uses the structs, don't include these dummy definitions--
  20.    include the real ones */
  21.  
  22. struct CopList { int dummy; };
  23. struct UCopList { int dummy; };
  24. struct cprlist { int dummy; };
  25. struct Region { int dummy; };
  26. struct VSprite { int dummy; };
  27. struct collTable { int dummy; };
  28. struct KeyMap { int dummy; };
  29. struct Device { int dummy; };
  30. struct Unit { int dummy; };
  31. struct GfxBase { int dummy; };
  32.  
  33. /* Include the definitions we need */
  34.  
  35. #include <exec/types.h>
  36. #include <intuition/intuition.h>
  37. #include <exec/memory.h>
  38.  
  39. /* Structures needed for libraries */
  40.  
  41. struct IntuitionBase *IntuitionBase;
  42. struct GfxBase *GfxBase;
  43.  
  44. /* Structures required for graphics */
  45.  
  46. struct Screen *BdScr;
  47. struct Window *BdWdw;
  48. struct ViewPort *WVPort;
  49.  
  50. /***************** Program Constants ****************************/
  51.  
  52. #define BdRp   BdWdw->RPort
  53.  
  54. #define INTUITION_REV  30   /* Internal version number */
  55. #define GRAPHICS_REV   30
  56. #define BLANKW    56      /* Width of die blank */
  57. #define BLANKH    23      /* Height of die blank */
  58. #define BLANKL   530      /* Left edge of die blanks */
  59. #define BLANKT    20      /* Top edge of die blanks */
  60. #define BLANKS    31      /* Space between blanks */
  61. #define DIEW      48      /* Width of each Die image */
  62. #define DIEH      19      /* Height of each Die image */
  63. #define DIEHOFF    4      /* Horizontal offset of die image from BlankL */
  64. #define DIEVOFF    2      /* Vertical offset of die image from BlankT */
  65. #define TEXTL      5      /* Left pixel of first text column */
  66. #define TEXTT     20      /* Top pixel of first text row */
  67. #define TEXTS      8      /* Space between each text line */
  68. #define SPACEW     10      /* number of dots wide--space character */
  69. #define SPACEH      9      /* number of dots high--space character */
  70. #define DOTL     155      /* left position of first dot character */
  71. #define DOTS      90      /* pixels between columns of dots=9*SPACEW */
  72. #define DOTT      36      /* line of first dot text=TEXT+2*TEXTS */
  73. #define HLINT     18      /* pixel of top horizontal line */
  74. #define HLINL      1      /* Leftmost pixel of top horizontal line */
  75. #define HLINR    489      /* Rightmost pixel of top horizontal line */
  76. #define HLINS      8      /* Space between horizontal lines */
  77. #define VLINT     13      /* Vertical line top pixel */
  78. #define VLINB    199      /* Vertical line bottom pixel */
  79. #define VLINL    128      /* Leftmost vertical line position */
  80. #define VLINS     90      /* Space between vertical lines */
  81. #define MAXLINES  23       /* Maximum number of screen lines */
  82. #define DICE       5      /* number of dice on screen */
  83. #define TURNS      5      /* the bones array member holding turns variable */
  84. #define MAXPLAYERS   4      /* maximum number of players */
  85. #define SCORECATS   21      /* number of scoring categories */
  86. #define BONUS      62      /* number of points needed for upper bonus */
  87. #define WHITE   0xFFF
  88. #define RED      0xF00
  89. #define GREEN   0x0F0
  90. #define BLUE   0x00F
  91. #define AQUA   0x0FF
  92. #define PURPLE    0xF0F
  93. #define YELLOW   0xFF0
  94. #define BLACK   0x000
  95.  
  96.  
  97. /***************** Image and other data structs ****************/
  98.  
  99. /* Image data for dice spots.  All 48 bits are used for the image.
  100.    We move this data down to CHIP memory, just in case (later versions
  101.    will lets us allocate structures in CHIP memory--so they say)*/
  102.  
  103. USHORT SpotData [] [57] ={
  104. /* one spot */
  105.  
  106.    0x0000, 0x0000, 0x0000,
  107.    0x0000, 0x0000, 0x0000,
  108.    0x0000, 0x0000, 0x0000,
  109.    0x0000, 0x0000, 0x0000,
  110.    0x0000, 0x0000, 0x0000,
  111.    0x0000, 0x0000, 0x0000,
  112.    0x0000, 0x0000, 0x0000,
  113.    0x0000, 0x07E0, 0x0000,
  114.    0x0000, 0x1FF8, 0x0000,
  115.    0x0000, 0x1FF8, 0x0000,
  116.    0x0000, 0x1FF8, 0x0000,
  117.    0x0000, 0x07E0, 0x0000,
  118.    0x0000, 0x0000, 0x0000,
  119.    0x0000, 0x0000, 0x0000,
  120.    0x0000, 0x0000, 0x0000,
  121.    0x0000, 0x0000, 0x0000,
  122.    0x0000, 0x0000, 0x0000,
  123.    0x0000, 0x0000, 0x0000,
  124.    0x0000, 0x0000, 0x0000,
  125.  
  126. /* two spots*/
  127.  
  128.    0x1F80, 0x0000, 0x0000,
  129.    0x7FE0, 0x0000, 0x0000,
  130.    0x7FE0, 0x0000, 0x0000,
  131.    0x7FE0, 0x0000, 0x0000,
  132.    0x1F80, 0x0000, 0x0000,
  133.    0x0000, 0x0000, 0x0000,
  134.    0x0000, 0x0000, 0x0000,
  135.    0x0000, 0x0000, 0x0000,
  136.    0x0000, 0x0000, 0x0000,
  137.    0x0000, 0x0000, 0x0000,
  138.    0x0000, 0x0000, 0x0000,
  139.    0x0000, 0x0000, 0x0000,
  140.    0x0000, 0x0000, 0x0000,
  141.    0x0000, 0x0000, 0x0000,
  142.    0x0000, 0x0000, 0x01F8,
  143.    0x0000, 0x0000, 0x07FE,
  144.    0x0000, 0x0000, 0x07FE,
  145.    0x0000, 0x0000, 0x07FE,
  146.    0x0000, 0x0000, 0x01F8,
  147.  
  148. /* three spots */
  149.  
  150.    0x1F80, 0x0000, 0x0000,
  151.    0x7FE0, 0x0000, 0x0000,
  152.    0x7FE0, 0x0000, 0x0000,
  153.    0x7FE0, 0x0000, 0x0000,
  154.    0x1F80, 0x0000, 0x0000,
  155.    0x0000, 0x0000, 0x0000,
  156.    0x0000, 0x0000, 0x0000,
  157.    0x0000, 0x07E0, 0x0000,
  158.    0x0000, 0x1FF8, 0x0000,
  159.    0x0000, 0x1FF8, 0x0000,
  160.    0x0000, 0x1FF8, 0x0000,
  161.    0x0000, 0x07E0, 0x0000,
  162.    0x0000, 0x0000, 0x0000,
  163.    0x0000, 0x0000, 0x0000,
  164.    0x0000, 0x0000, 0x01F8,
  165.    0x0000, 0x0000, 0x07FE,
  166.    0x0000, 0x0000, 0x07FE,
  167.    0x0000, 0x0000, 0x07FE,
  168.    0x0000, 0x0000, 0x01F8,
  169.  
  170. /* four spots */
  171.  
  172.    0x1F80, 0x0000, 0x01F8,
  173.    0x7FE0, 0x0000, 0x07FE,
  174.    0x7FE0, 0x0000, 0x07FE,
  175.    0x7FE0, 0x0000, 0x07FE,
  176.    0x1F80, 0x0000, 0x01F8,
  177.    0x0000, 0x0000, 0x0000,
  178.    0x0000, 0x0000, 0x0000,
  179.    0x0000, 0x0000, 0x0000,
  180.    0x0000, 0x0000, 0x0000,
  181.    0x0000, 0x0000, 0x0000,
  182.    0x0000, 0x0000, 0x0000,
  183.    0x0000, 0x0000, 0x0000,
  184.    0x0000, 0x0000, 0x0000,
  185.    0x0000, 0x0000, 0x0000,
  186.    0x1F80, 0x0000, 0x01F8,
  187.    0x7FE0, 0x0000, 0x07FE,
  188.    0x7FE0, 0x0000, 0x07FE,
  189.    0x7FE0, 0x0000, 0x07FE,
  190.    0x1F80, 0x0000, 0x01F8,
  191.  
  192. /* five spots */
  193.  
  194.    0x1F80, 0x0000, 0x01F8,
  195.    0x7FE0, 0x0000, 0x07FE,
  196.    0x7FE0, 0x0000, 0x07FE,
  197.    0x7FE0, 0x0000, 0x07FE,
  198.    0x1F80, 0x0000, 0x01F8,
  199.    0x0000, 0x0000, 0x0000,
  200.    0x0000, 0x0000, 0x0000,
  201.    0x0000, 0x07E0, 0x0000,
  202.    0x0000, 0x1FF8, 0x0000,
  203.    0x0000, 0x1FF8, 0x0000,
  204.    0x0000, 0x1FF8, 0x0000,
  205.    0x0000, 0x07E0, 0x0000,
  206.    0x0000, 0x0000, 0x0000,
  207.    0x0000, 0x0000, 0x0000,
  208.    0x1F80, 0x0000, 0x01F8,
  209.    0x7FE0, 0x0000, 0x07FE,
  210.    0x7FE0, 0x0000, 0x07FE,
  211.    0x7FE0, 0x0000, 0x07FE,
  212.    0x1F80, 0x0000, 0x01F8,
  213.  
  214. /* six spots */
  215.  
  216.    0x1F80, 0x0000, 0x01F8,
  217.    0x7FE0, 0x0000, 0x07FE,
  218.    0x7FE0, 0x0000, 0x07FE,
  219.    0x7FE0, 0x0000, 0x07FE,
  220.    0x1F80, 0x0000, 0x01F8,
  221.    0x0000, 0x0000, 0x0000,
  222.    0x0000, 0x0000, 0x0000,
  223.    0x1F80, 0x0000, 0x01F8,
  224.    0x7FE0, 0x0000, 0x07FE,
  225.    0x7FE0, 0x0000, 0x07FE,
  226.    0x7FE0, 0x0000, 0x07FE,
  227.    0x1F80, 0x0000, 0x01F8,
  228.    0x0000, 0x0000, 0x0000,
  229.    0x0000, 0x0000, 0x0000,
  230.    0x1F80, 0x0000, 0x01F8,
  231.    0x7FE0, 0x0000, 0x07FE,
  232.    0x7FE0, 0x0000, 0x07FE,
  233.    0x7FE0, 0x0000, 0x07FE,
  234.    0x1F80, 0x0000, 0x01F8,
  235. };
  236.  
  237. USHORT (*SpotData_chip)[57];
  238. SHORT boardlines[] =
  239.  {
  240.    HLINR,VLINT,
  241.    HLINR,VLINB,
  242.    HLINL-1,VLINB,
  243.    HLINL-1,VLINT,
  244.    HLINL,VLINT,
  245.    HLINL,VLINB,
  246.    HLINR-1,VLINB,
  247.    HLINR-1,VLINT
  248. };               
  249.  
  250.    static USHORT colormap [8] =
  251.       {
  252.       WHITE,   /* background color */
  253. #define BGRP     0
  254.       RED,      /* color of window-close box */
  255. #define REDP     1
  256.       GREEN,   /* color of menu title */
  257. #define GRNP     2
  258.       YELLOW,   /* color of window-close dot */
  259. #define YELP     3
  260.       AQUA,   
  261. #define AQUP     4
  262.       PURPLE,   
  263. #define PURP     5
  264.       BLUE,
  265. #define BLUP     6
  266.       BLACK
  267. #define BLKP     7
  268.       };
  269.  
  270.    static char *textline [MAXLINES+4] = {
  271. "Players",
  272. " ",
  273. "Aces       ",
  274. "Twos       ",
  275. "Threes     ",
  276. "Fours      ",
  277. "Fives      ",
  278. "Sixes      ",
  279. " ",
  280. "Upper Total",
  281. "Bonus      ",
  282. " ",
  283. "3 of a Kind",
  284. "4 of a Kind",
  285. "Full House ",
  286. "Sm Straight",
  287. "Lg Straight",
  288. "Yacht      ",
  289. "Yarboro    ",
  290. " ",
  291. "Lower Total",
  292. " ",
  293. "Grand Total",
  294. "  One   ",
  295. "  Two   ",
  296. " Three  ",
  297. "  Four  "};
  298.  
  299. /* ****************** Pre-initialized Intuition Structures************* */
  300.  
  301.  
  302. struct TextAttr StdFont =
  303.    {
  304.    "topaz.font",              /* Font Name */
  305.    TOPAZ_SIXTY,               /* Font Height */
  306.    FS_NORMAL,                 /* Style */
  307.    FPF_ROMFONT,               /* Preferences */
  308.    };
  309.  
  310. /************* Images structures ***************/
  311.  
  312. struct Image Blank =
  313. {
  314.    0,0,         /* left, top */
  315.    BLANKW,BLANKH,1,      /* width, height, depth */
  316.    NULL,         /* image data */
  317.    0x00,0x01,      /* PlanePick, PlaneOnOff */
  318.    NULL,         /* NextImage */
  319.  
  320. };
  321. /* An array of six image structs, holding the images of each die
  322.    face, from 1-6 */
  323.  
  324. struct Image DieImage []={
  325. {
  326.    DIEHOFF,DIEVOFF,   /* left, top */
  327.    DIEW,DIEH,1,      /* width, height, depth */
  328.    NULL,            /* dummy image data--to be filled in after image data
  329.                        is moved to chip memory */
  330.    YELP-REDP,REDP,         /* PlanePick, PlaneOnOff */
  331.    NULL            /* NextImage */
  332.  
  333. },
  334.  
  335.  
  336. {DIEHOFF,DIEVOFF,DIEW,DIEH,1,NULL,YELP-REDP,REDP,NULL},   /*die images 1-5 */
  337. {DIEHOFF,DIEVOFF,DIEW,DIEH,1,NULL,YELP-REDP,REDP,NULL},
  338. {DIEHOFF,DIEVOFF,DIEW,DIEH,1,NULL,YELP-REDP,REDP,NULL},
  339. {DIEHOFF,DIEVOFF,DIEW,DIEH,1,NULL,YELP-REDP,REDP,NULL},
  340. {DIEHOFF,DIEVOFF,DIEW,DIEH,1,NULL,YELP-REDP,REDP,NULL},
  341.  
  342.  
  343. };
  344.  
  345. /*******Here come da Gadgets ********/
  346.  
  347. struct Gadget DieGadg [6] ={
  348. {
  349.    NULL,                  /* Next Gadget */
  350.    BLANKL,BLANKT,            /* Left Edge, Top Edge */   
  351.    BLANKW,BLANKH,            /* Width, Height */
  352.    GADGHIMAGE + GADGIMAGE,      /*Flags--highlight type, render type */
  353.    NULL,                  /* Activation flags */
  354.    BOOLGADGET,               /* Gadget type */
  355.    (APTR)&DieImage[5],         /* Image structure for drawing gadget */
  356.    (APTR)&Blank,            /* Alternate image for highlighting */
  357.    NULL,                  /* Intuitext structure for gadget text */
  358.    NULL,                  /* Mutual exclude, non-functional */
  359.    NULL,                  /* Special info for proportional, string */
  360.    NULL,         
  361.  
  362.          /* Gadget ID/*
  363.    NULL,                  /* User Data */
  364. },
  365.  
  366. {&DieGadg[0],BLANKL,BLANKS+BLANKT,BLANKW,BLANKH,   /* DieGadg 1-4 */
  367. GADGHIMAGE + GADGIMAGE,NULL,BOOLGADGET,
  368. (APTR)&DieImage[5],(APTR)&Blank,NULL,NULL,NULL,NULL,NULL},
  369.  
  370. {&DieGadg[1],BLANKL,(2*BLANKS)+BLANKT,BLANKW,BLANKH,
  371. GADGHIMAGE + GADGIMAGE,NULL,BOOLGADGET,
  372. (APTR)&DieImage[5],(APTR)&Blank,NULL,NULL,NULL,NULL,NULL},
  373.  
  374. {&DieGadg[2],BLANKL,(3*BLANKS)+BLANKT,BLANKW,BLANKH,
  375. GADGHIMAGE + GADGIMAGE,NULL,BOOLGADGET,
  376. (APTR)&DieImage[5],(APTR)&Blank,NULL,NULL,NULL,NULL,NULL},
  377.  
  378. {&DieGadg[3],BLANKL,(4*BLANKS)+BLANKT,BLANKW,BLANKH,
  379. GADGHIMAGE + GADGIMAGE,NULL,BOOLGADGET,
  380. (APTR)&DieImage[5],(APTR)&Blank,NULL,NULL,NULL,NULL,NULL},
  381.  
  382. };
  383.  
  384. struct Gadget ButtonGadget =
  385. {
  386.    &DieGadg[4],                  /* Next Gadget */
  387.    BLANKL,(5*BLANKS)+BLANKT,   /* Left Edge, Top Edge */   
  388.    BLANKW,BLANKH,            /* Width, Height */
  389.    GADGHCOMP + GADGIMAGE+ GADGDISABLED,       /*Flags--highlight type, render type */
  390.    RELVERIFY,                /* Activation flags */
  391.    BOOLGADGET,               /* Gadget type */
  392.    (APTR)&Blank,            /* Image structure for drawing gadget */
  393.    NULL,                  /* Alternate image for highlighting */
  394.    NULL,                  /* Intuitext structure for gadget text */
  395.    NULL,                  /* Mutual exclude, non-functional */
  396.    NULL,                  /* Special info for proportional, string */
  397.    NULL,                  /* Gadget ID/*
  398.    NULL,                  /* User Data */
  399. };
  400.  
  401. struct Gadget ScoreGadget ={
  402.    &ButtonGadget,            /* Next Gadget */
  403.    VLINL+4,HLINT+(2*HLINS)-5,   /* Left Edge, Top Edge */   
  404.    VLINS-6,(17*HLINS),         /* Width, Height */
  405.    GADGHNONE,               /*Flags--highlight type, render type */
  406.    RELVERIFY,               /* Activation flags */
  407.    BOOLGADGET,               /* Gadget type */
  408.    NULL,                  /* Image structure for drawing gadget */
  409.    NULL,                  /* Alternate image for highlighting */
  410.    NULL,                  /* Intuitext structure for gadget text */
  411.    NULL,                  /* Mutual exclude, non-functional */
  412.    NULL,                  /* Special info for proportional, string */
  413.    NULL,                  /* Gadget ID/*
  414.    NULL                  /* User Data */
  415. };
  416. /************* finally, the Menus and their ITexts *************/
  417.  
  418. struct IntuiText AboutText [10] = {
  419.  
  420.    {BLUP,BGRP,JAM2,30,9,&StdFont,   "                                           ",NULL},
  421.    {BLUP,BGRP,JAM2,30,18,&StdFont,
  422.    "                   YachtC                  ",&AboutText[0]},
  423.  
  424.    {BLUP,BGRP,JAM2,30,27,&StdFont,
  425.    "      Copyright 1985 by Sheldon Leemon     ",&AboutText[1]},
  426.  
  427.    {BLUP,BGRP,JAM2,30,36,&StdFont,
  428.    "                                           ",&AboutText[2]},
  429.  
  430.    {BLUP,BGRP,JAM2,30,45,&StdFont,
  431.    " You may copy and distribute this program  ",&AboutText[3]},
  432.  
  433.    {BLUP,BGRP,JAM2,30,54,&StdFont,
  434.    " freely (i.e. for no money), but any kind  ",&AboutText[4]},
  435.  
  436.    {BLUP,BGRP,JAM2,30,63,&StdFont,
  437.    " of commercial exploitation is a no-no.    ",&AboutText[5]},
  438.  
  439.    {BLUP,BGRP,JAM2,30,72,&StdFont,
  440.    " Comments may be sent to the author via    ",&AboutText[6]},
  441.  
  442.    {BLUP,BGRP,JAM2,30,81,&StdFont,
  443.    " Delphi (DRX) or CompuServe (72705,1355).  ",&AboutText[7]},
  444.  
  445.    {BLUP,BGRP,JAM2,30,90,&StdFont,   
  446.    "                                           ",&AboutText[8]},
  447.  
  448. };
  449.  
  450. struct IntuiText InstructText [14] = {
  451.  
  452.    {BLUP,BGRP,JAM2,30,9,&StdFont,
  453.    "                                           ",NULL},
  454.  
  455.    {BLUP,BGRP,JAM2,30,18,&StdFont,
  456.    "                Instructions               ",&InstructText[0]},
  457.  
  458.    {BLUP,BGRP,JAM2,30,27,&StdFont,
  459.    "                                           ",&InstructText[1]},
  460.  
  461.    {BLUP,BGRP,JAM2,30,36,&StdFont,
  462.    " To start game, select 1-4 Player game from",&InstructText[2]},
  463.  
  464.    {BLUP,BGRP,JAM2,30,45,&StdFont,
  465.    " the Project menu.  Each player gets up to ",&InstructText[3]},
  466.  
  467.    {BLUP,BGRP,JAM2,30,54,&StdFont,
  468.    " 3 rolls of the dice to make the best hand ",&InstructText[4]},
  469.  
  470.    {BLUP,BGRP,JAM2,30,63,&StdFont,
  471.    " possible.  Click on the dice you wish to  ",&InstructText[5]},
  472.  
  473.    {BLUP,BGRP,JAM2,30,72,&StdFont,
  474.    " change, then click on the button below the",&InstructText[6]},
  475.  
  476.    {BLUP,BGRP,JAM2,30,81,&StdFont,
  477.    " dice to roll.  If you are satisfied with  ",&InstructText[7]},
  478.  
  479.    {BLUP,BGRP,JAM2,30,90,&StdFont,
  480.    " your hand, and wish to score, click on the",&InstructText[8]},
  481.  
  482.    {BLUP,BGRP,JAM2,30,99,&StdFont,
  483.    " button without blanking any dice.  All    ",&InstructText[9]},
  484.  
  485.    {BLUP,BGRP,JAM2,30,108,&StdFont,
  486.    " possible scores will appear in blue on    ",&InstructText[10]},
  487.  
  488.    {BLUP,BGRP,JAM2,30,117,&StdFont,
  489.    " the scorepad.  Click on the one you want. ",&InstructText[11]},
  490.  
  491.    {BLUP,BGRP,JAM2,30,126,&StdFont,
  492.    "                                           ",&InstructText[12]},
  493.  
  494. };
  495.  
  496. struct IntuiText OKText = 
  497.    {BLUP,BGRP,JAM2,6,3,&StdFont," Proceed ",NULL};
  498.  
  499.  
  500. struct IntuiText Menu0IText [] = {
  501.  
  502.    {
  503.    BLUP,BGRP,JAM2,      /* Front Pen, Back Pen, Draw Mode */ 
  504.    0,0,            /* Left Edge, Top Edge */
  505.    &StdFont,         /* pointer to Text Font */
  506.    " Start 1-Player Game ",   /* text of Menu Item */
  507.    NULL            /* pointer to next IText */
  508.    },
  509.  
  510.    {BLUP,BGRP,JAM2,0,0,&StdFont," Start 2-Player Game ",NULL },
  511.    {BLUP,BGRP,JAM2,0,0,&StdFont," Start 3-Player Game ",NULL },
  512.    {BLUP,BGRP,JAM2,0,0,&StdFont," Start 4-Player Game ",NULL },
  513. };
  514.  
  515. struct IntuiText Menu1IText [] = {
  516.    {BLUP,BGRP,JAM2,0,0,&StdFont," Instructions ",NULL },
  517.    {BLUP,BGRP,JAM2,0,0,&StdFont," About YachtC ",NULL },
  518. };
  519.  
  520. struct MenuItem Menu0Item[4] = {
  521.    {
  522.    &Menu0Item[1],         /* pointer to next Item */
  523.    0,0,210,9,      /* Left, Top, Width, Height */
  524.    ITEMTEXT | ITEMENABLED | HIGHCOMP,   /* Flags */
  525.    0,            /* no mutual exclude */
  526.    (APTR)&Menu0IText[0],   /* Render info */   
  527.    NULL,NULL,NULL,         /*Alt Image, Command (amiga) char, subitem*/
  528.    MENUNULL      /* next select */
  529.    },
  530.  
  531.    {&Menu0Item[2],0,9,210,9,ITEMTEXT | ITEMENABLED | HIGHCOMP,
  532.    0,(APTR)&Menu0IText[1],NULL,NULL,NULL,MENUNULL},
  533.  
  534.    {&Menu0Item[3],0,18,210,9,ITEMTEXT | ITEMENABLED | HIGHCOMP,
  535.    0,(APTR)&Menu0IText[2],NULL,NULL,NULL,MENUNULL},
  536.  
  537.    {NULL,0,27,210,9,ITEMTEXT | ITEMENABLED | HIGHCOMP,
  538.    0,(APTR)&Menu0IText[3],NULL,NULL,NULL,MENUNULL}
  539. };
  540.  
  541. struct MenuItem Menu1Item[2] = {
  542.    
  543.    {&Menu1Item[1],0,0,140,9,ITEMTEXT | ITEMENABLED | HIGHCOMP,
  544.    0,(APTR)&Menu1IText[0],NULL,NULL,NULL,MENUNULL},
  545.  
  546.    {NULL,0,9,140,9,ITEMTEXT | ITEMENABLED | HIGHCOMP,
  547.    0,(APTR)&Menu1IText[1],NULL,NULL,NULL,MENUNULL}
  548.  
  549. };
  550.  
  551.  
  552. struct Menu BdMenu [2] = {
  553.    {
  554.    &BdMenu[1],      /* ptr to next Menu */   
  555.    40,0,90,0,   /* left,top,width,height--top and height ignored */
  556.    MENUENABLED,   /* Flags */
  557.    " Project ",   /* menu title */
  558.    &Menu0Item[0]   /* First Item in list */
  559.    },
  560.  
  561. {NULL,160,0,130,0,MENUENABLED," Information ",&Menu1Item[0]}
  562.  
  563. };
  564.    
  565. /* ********Pre-initialized NewScreen and NewWindow Structures*********** */
  566.  
  567.    struct NewScreen NewBdScr =
  568.       {
  569.       0,0,               /* LeftEdge (always=0),TopEdge */
  570.       640,200,3,       
  571.  
  572.   /* Width, Height, Depth */
  573.       PURP,GRNP,         /* DetailPen and BlockPen */
  574.       HIRES,            /* special display modes */
  575.       CUSTOMSCREEN,         /* Screen Type */
  576.       &StdFont,            /* Pointer to Custom font structure*/
  577.       NULL,               /* Pointer to title text */
  578.       NULL,               /* Pointer to Screen Gadgets */
  579.       NULL,               /* Pointer to CustomBitMap */
  580.       };
  581.  
  582.  
  583. struct NewWindow NewBoardWindow =
  584.    {
  585.    0,0,         /* Left Edge, Top Edge */
  586.    640,200,      /* Width, Height */
  587.    BLUP,YELP,      /* Block Pen, Detail Pen */
  588.    GADGETUP + CLOSEWINDOW + MENUPICK,         /* IDCMP Flags */
  589.    SMART_REFRESH + ACTIVATE +WINDOWDEPTH
  590.    + BORDERLESS + WINDOWCLOSE,               /* Flags */
  591.    &ScoreGadget,  /* Pointer to First Gadget */
  592.    NULL,          /* Pointer to Check Mark Image */
  593.    "                        YachtC",         /* Title */
  594.    NULL,          /* Pointer to Screen structure */
  595.    NULL,         /* Pointer to custom Bit Map */
  596.    0,0,         /* Minimum Width, Height */
  597.    0,0,         /* Maximum Width, Height */
  598.    CUSTOMSCREEN   /* Type of Screen it resides on */
  599.    };
  600.  
  601. /* *************************Program Begins Here******************* */
  602.  
  603. main()
  604. {
  605.    USHORT bones [DICE];         /* The array for dice values */
  606.    USHORT cats;
  607.    int scores [MAXPLAYERS] [SCORECATS];
  608.    USHORT IMsg(), flag;
  609.    USHORT players, cur_player, turns;
  610.  
  611.  
  612.  
  613. init_scr();          /* do one-time initialization of screen */
  614.  
  615. players = 1;
  616. while(players){
  617.  
  618.  
  619. /* initialize the scores */
  620.  
  621. for(players=cur_player=0;players<MAXPLAYERS;players++){
  622.    for(cats=0; cats<SCORECATS; scores[players][cats++] = -1)
  623.       ;   /* blank the scoring columns to -1 to start with */
  624.  
  625.    for(turns=6; turns<10;
  626.  
  627.    scores[players][turns+11] = 0, scores[players][turns++] = 0)
  628.       ;   /* except for the rows with graphics or totals (they = 0) */
  629.    }
  630.  
  631. /* get number of players */
  632.  
  633. while( (flag=IMsg()) < 64);   /* wait til new game menu item selected */
  634. players = flag - 63;      /* 1-4 player game selected */
  635.  
  636. init_pad();      /* draw the score pad */
  637.  
  638. SetDrMd (BdRp,JAM1);
  639. for (turns=0;turns<players;turns++)
  640.    Name(turns);
  641.  
  642. /* play a whole round */
  643.  
  644. for (turns=0;turns<13;turns++)
  645.    for (cur_player=0; cur_player<players ;cur_player++)
  646.       {
  647.  
  648.  
  649.  
  650.       SetDrMd(BdRp,JAM2+INVERSVID);   /*   highlight the player's name */
  651.       Name(cur_player);
  652.  
  653.       roll_dice(bones);   /* get dice values */
  654.       score_turn(scores[cur_player],bones,cur_player);
  655.  
  656.       SetDrMd(BdRp,JAM2);         /* unhighlight the player's name */
  657.       Name(cur_player);
  658.  
  659.       }   /* for */
  660. }   /* while */
  661. }   /* end of main */
  662.  
  663. roll_dice(bones)
  664. USHORT bones [];
  665.  
  666. {
  667.    USHORT changed,dieno,flag;
  668.    USHORT Shake(),Rollrep(),IMsg();
  669.  
  670. for(dieno=0;dieno<DICE;dieno++)      /* do first roll */
  671.  
  672.    {
  673.       DieGadg[dieno].Activation = TOGGLESELECT;
  674.       bones[dieno]=Rollrep(dieno);  /* roll dice 5 times and store result */
  675.    } /* for */
  676.  
  677. OnGadget(&ButtonGadget,BdWdw,NULL);
  678. changed = bones[TURNS] = 1;
  679.  
  680. while(changed && bones[TURNS]<3)
  681.   
  682.  
  683.  {
  684.    while( ((flag=IMsg()) < 17) || (flag >24) );   /* wait til button pushed */
  685.    changed = Shake(bones);            /* shake if any are changed */
  686.    }
  687.  
  688. OffGadget(&ButtonGadget,BdWdw,NULL);
  689. for(dieno = 0; dieno < DICE ; dieno++)      /* turn gadgets off */
  690.    DieGadg[dieno].Activation = NULL;
  691.  
  692. }/* end of roll_ */
  693.  
  694.  
  695. score_turn(scores,bones,cur_player)
  696.  
  697. int scores[];
  698. USHORT bones[];
  699. USHORT cur_player;
  700.  
  701. {
  702.    USHORT IMsg();
  703.    unsigned int Evaluate(),score;
  704.    USHORT row;
  705.  
  706.    /* position score gadget */
  707.  
  708.  
  709.      ScoreGadget.LeftEdge = VLINL + (VLINS*cur_player) + 4;
  710.    /*   AddGadget(BdWdw,&ScoreGadget,-1); */
  711.  
  712. /* show possible scores to let player select */
  713.  
  714.  
  715.  
  716. for (row = 0; row <17; row ++)
  717.    if (scores[row] == -1)
  718.    {
  719.       SetAPen (BdRp,BGRP);   /* erase dots with bg pen */
  720.       ShowDots (row,cur_player);
  721.       SetAPen (BdRp,BLUP);   /* possible scores in green */
  722.       score = Evaluate(bones,row);
  723.       ShowScore (score,row,cur_player);
  724.    }
  725.  
  726.  
  727.    /* wait  until user clicks on a score of an unused category */
  728.    while( ( (row=IMsg()) > 17) || (scores[row] != -1 ) );
  729.  
  730.  
  731. SetAPen (BdRp,BLKP);   /* selected scores in black */
  732. score = Evaluate(bones,row);   /* evaluate row selected */
  733. ShowScore (scores[row]=score,row,cur_player);   /* print in black */
  734.  
  735.  
  736. if (row<7)
  737.    {
  738.    ClearRow(7,cur_player);
  739.    ShowScore (scores[7]+=score,7,cur_player);   /* do upper sub-total */
  740.    }
  741. else
  742.    {
  743.    ClearRow(18,cur_player);
  744.    ShowScore (scores[18]+=score,18,cur_player);   /* or else lower total */
  745.    }
  746. if (scores[7] > BONUS) 
  747.    {
  748.    ClearRow(8,cur_player);
  749.    ShowScore (scores[8] = 35, 8, cur_player);   /* check for bonus */
  750.    }
  751.  
  752. /*add sub-totals to total and display  */
  753.  
  754. ClearRow(20,cur_player);
  755. ShowScore (scores[20]=scores[7]+scores[8]+scores[18],20,cur_player);
  756.    
  757.  
  758.  
  759. for (row = 0; row <17; row ++)
  760.    if (scores[row] == -1)
  761.    {
  762.       SetAPen (BdRp,BGRP);   /* erase scores with bg pen */
  763.       score = Evaluate(bones,row);
  764.       ShowScore (score,row,cur_player);
  765.       SetAPen (BdRp,BLKP);   /* draw dots in black pen */
  766.  
  767.  
  768.       ShowDots (row,cur_player);
  769.    }
  770.  
  771. }
  772.  
  773.  
  774. USHORT IMsg()
  775.  
  776. {
  777.    struct IntuiMessage *BdMsg;      /* Intuition message structure */
  778.    ULONG Mclass;               /* Message class */
  779.    USHORT Mcode,flag;            /* Message code */
  780.    APTR Maddress;               /* Address of structure that caused message */
  781.    SHORT Mmx, Mmy ;            /* Message mouse x and y */
  782.  
  783.  
  784. flag = 35;
  785. Wait (1 << BdWdw->UserPort->mp_SigBit);
  786. while (BdMsg = (struct IntuiMessage *)GetMsg(BdWdw->UserPort))
  787.    {
  788.    Mclass = BdMsg->Class;
  789.    Mcode = BdMsg->Code;
  790.    Maddress = BdMsg->IAddress;
  791.    Mmx = BdMsg->MouseX;
  792.    Mmy = BdMsg->MouseY;
  793.    ReplyMsg(BdMsg);
  794.    switch (Mclass) {
  795.       case CLOSEWINDOW:
  796.          Cleanup();
  797.          exit(TRUE);
  798.          break;
  799.  
  800.       case GADGETUP:
  801.  
  802.  
  803.          flag = (Mmy-29)/8;
  804.          break;
  805.  
  806.       case MENUPICK:
  807.          switch (MENUNUM(Mcode)){
  808.             case 0:
  809.                flag = 64 + ITEMNUM(Mcode);
  810.                break;
  811.             case 1:
  812.                switch (ITEMNUM(Mcode)){
  813.                   case 0:
  814.                      AutoRequest
  815.                      (BdWdw,&InstructText[13],NULL,&OKText,0,0,515,180);
  816.                      flag = 32;
  817.                      break;
  818.                   case 1:
  819.                      AutoRequest
  820.                      (BdWdw,&AboutText[9],NULL,&OKText,0,0,515,140);
  821.                      flag = 32;
  822.                      break;
  823.                   }   /* end of Item switch */
  824.                   break;
  825.             }   /* end of MenuNum switch */
  826.             break;
  827.    } 
  828.  
  829.   /* end of Class switch */      
  830.             
  831.    }/* while */
  832.  
  833. return(flag);
  834. }
  835.  
  836. USHORT Shake(bones)
  837. USHORT bones[];
  838. {
  839.    USHORT dieno,changed,Rollrep();
  840.    for(dieno=changed=0;dieno<DICE;dieno++)
  841.    {
  842.       OnGadget(&DieGadg[dieno],BdWdw,NULL);
  843.       if(DieGadg[dieno].Flags & SELECTED)
  844.       {
  845.          bones[dieno]=Rollrep(dieno);  /* roll dice and store result */
  846.          Deselect(dieno);
  847.          changed++;
  848.  
  849.       } /* if */
  850.    } /* for */
  851.    bones[TURNS]++;
  852. return(changed);
  853. }
  854.  
  855. USHORT Rollrep(dieno)
  856. USHORT dieno;
  857. {
  858. USHORT reps, throw;
  859.  
  860. for (reps=0;reps<9;reps++)
  861. {
  862.    throw = rand()%6;
  863.    DrawImage(BdRp,&Blank,BLANKL, (BLANKS*dieno)+BLANKT);
  864.    DrawImage(BdRp,&DieImage[throw],BLANKL, (BLANKS*dieno)+BLANKT);
  865. }
  866. DieGadg[dieno].GadgetRender=(APTR)&DieImage[throw];
  867. return(throw);
  868. }
  869.  
  870. Deselect (dieno)
  871. USHORT dieno;
  872. {
  873. USHORT Gadgetno ;
  874.  
  875. /* Since its not nice to change the SELECTED flag while the gadget is active */
  876. /* (only the user is supposed to do that, by clicking on it), we'l be nice */
  877. /* and first Remove the die gadget from the list, THEN change the flag */
  878. /* and finally, Add it back to the list again. */
  879.  
  880. Gadgetno = RemoveGadget(BdWdw, &DieGadg[dieno]);
  881. DieGadg[dieno].Flags ^= SELECTED;               /* toggle SELECTED flag */
  882. AddGadget(BdWdw,&DieGadg[
  883.  
  884. dieno],Gadgetno);
  885. }
  886.  
  887.  
  888. unsigned int Evaluate (bones,row)
  889. USHORT *bones;
  890. USHORT row;
  891. {
  892. unsigned int values[7];
  893. unsigned int count, flag;
  894.  
  895. /* This routine evaluates the current dice values in the bones array */
  896. /* in terms of the score they produce for the scoring category passed */
  897. /* in row.  It returns the score. */
  898.  
  899. for(count=0;count<7;count++)
  900.    values[count]=0;         /* zero out temporarily sort array */
  901.  
  902. for(count=0;count<5;count++){   /* sort dice by number of spots */
  903.    values[bones[count]]++;
  904.  
  905.  
  906.   values[6]+=(1+bones[count]);   /* add die to total */
  907.    }
  908. switch(row)
  909.       {
  910. /* spot dice */
  911.  
  912.       case 0:
  913.       case 1:
  914.       case 2:
  915.       case 3:
  916.       case 4:
  917.       case 5:         return((row+1)*values[row]);   /* return total of desired spots */
  918.    
  919. /* 3 of a kind */
  920.  
  921.       case 10:
  922.          for(count=flag=0;count<6;count++)
  923.             if(values[count] > 2)
  924.                flag = 1;
  925.          return( (flag) ? values[6] : 0);
  926.  
  927. /* 4 of a kind */
  928.  
  929.       case 11:
  930.          for(count=flag=0;count<6;count++)
  931.             if(values[count] > 3)
  932.                flag = 1;
  933.          return( (flag) ? values[6] : 0);
  934.  
  935. /* full house */
  936.       case 12:
  937.          for(count=flag=0;count<6;count++)
  938.             if(values[count] > 1)
  939.                flag+=values[count];
  940.  
  941.  
  942.          return((unsigned int) ((flag == 5) ? 25 : 0));
  943.  
  944. /* small straight */
  945.  
  946.       case 13:
  947.          for(count=0; values[count] < 1 ; count++)
  948.             ;   /* skip zeros */
  949.  
  950.          if ( (!count) && (!values[1]) )
  951.             count = 2;      /* skip to 3 if there are 1's but no 2's */
  952.          for( flag=count+4; count < flag ; count++)
  953.             if (values[count] <1)
  954.                return(0);
  955.  
  956.          return(30);    /* if four in a row are 1 or more, you got it */
  957.  
  958. /* large straight */
  959.  
  960.       case 14:
  961.          for(count=0; values[count] < 1 ; count++)
  962.             ;      /* skip zeros */
  963.  
  964.          for( flag=count+5; count < flag ; count++)
  965.             if (values[count] !=1)
  966.                return(0);
  967.  
  968.          return(40);      /* if five in a row, score */
  969.  
  970. /* yacht */
  971.  
  972.       case 15:
  973.          for(count=flag=0;count<6;count++)
  974.             if(values[count] == 5)
  975.                flag = 1;
  976.          return( (unsigned int) ((flag) ? 50 : 0));
  977.  
  978. /* yarboro */
  979.  
  980.       case 16:
  981.          return(values[6]);
  982.  
  983. /* better not get here! */
  984.  
  985.       default:
  986.          return(0);   
  987.    }
  988.    
  989. }
  990.  
  991.  
  992. ShowScore(score,row,player)
  993. USHORT score,row,player;
  994. {
  995. int length;
  996. char *score_str = "0000";
  997.  
  998.    SetDrMd(BdRp,JAM1);
  999.    Move (BdRp,DOTL + (DOTS*player), (row*TEXTS)+DOTT );
  1000.    Text (BdRp, "    ",4);
  1001.    length = stcu_d (score_str,score,4);
  1002.    Move (BdRp,
  1003.       DOTL + (DOTS*player + ((4-length)*SPACEW) ), (row*TEXTS)+DOTT );
  1004.    Text (BdRp, score_str, length);
  1005.  
  1006. }
  1007.  
  1008.  
  1009. ShowDots (row,player)
  1010. USHORT row,player;
  1011. {
  1012.    Move (BdRp,DOTL + (DOTS*player), (row*TEXTS)+DOTT );
  1013.    SetDrMd(BdRp,JAM1);
  1014.    Text (BdRp, "....",4);
  1015.  
  1016. }
  1017.  
  1018. ClearRow (row,player)
  1019. USHORT row,player;
  1020. {
  1021.  
  1022.    Move (BdRp,DOTL + (DOTS*player), (row*TEXTS)+DOTT );
  1023.    SetDrMd(BdRp,JAM2);
  1024.    Text (BdRp, "    ",4);
  1025.  
  1026. }
  1027.  
  1028. Name (player)
  1029. USHORT player;
  1030. {
  1031.  
  1032.    Move(BdRp, DOTL -(2*SPACEW) + (DOTS*player), TEXTT+2);
  1033.    Text(BdRp, textline[MAXLINES+player], 8);
  1034.  
  1035. }
  1036.  
  1037.  
  1038.  
  1039. init_scr()
  1040. {
  1041.  
  1042. /* move image data to chip memory*/
  1043.  
  1044. if (InitImages() != TRUE) {
  1045.    printf("Not enough chip memory for images.\n");
  1046.  
  1047.  
  1048.   FreeImages();
  1049.    Exit(FALSE);
  1050.    }
  1051.  
  1052. /* Open the Intuition and Graphics libraries.
  1053.  * Get pointer to WCS routines, and if = 0, libraries aren't available.
  1054.  */
  1055.    IntuitionBase = (struct IntuitionBase *)
  1056.          OpenLibrary("intuition.library",INTUITION_REV);
  1057.    if (IntuitionBase == NULL) exit(FALSE);
  1058.  
  1059.    GfxBase = (struct GfxBase *)OpenLibrary("graphics.library", GRAPHICS_REV);
  1060.    if (GfxBase == NULL) exit(FALSE);
  1061.  
  1062. /* Open the Screen and Windows.  If they = 0, they weren't opened. */
  1063.  
  1064.    if ((NewBoardWindow.Screen = BdScr =
  1065.  (struct Screen *)OpenScreen(&NewBdScr)) == NULL)
  1066.       exit(FALSE);
  1067.  
  1068.    if (( BdWdw = (struct Window *)OpenWindow(&NewBoardWindow)) == NULL)
  1069.       exit(FALSE);
  1070.  
  1071. SetMenuStrip(BdWdw,&BdMenu);
  1072.  
  1073. init_pad();      /* draw the score pad */
  1074.  
  1075.  
  1076.  
  1077. }   /* end of init_scr */
  1078.  
  1079. init_pad()
  1080. {
  1081. /* Set up the board outline */
  1082.  
  1083.    ULONG Seconds,Micros;
  1084.    int count, column;
  1085.  
  1086.    WVPort = (struct ViewPort *)ViewPortAddress(BdWdw); /* find the viewport */
  1087.    LoadRGB4(WVPort,&colormap,8);   /* load our new set of colors */
  1088.  
  1089.    SetAPen (BdRp,BLKP);
  1090.    Move(BdRp,0,VLINT);
  1091.    SetDrMd (BdRp,JAM2);      /* JAM2 substituted */
  1092.  
  1093.    PolyDraw(BdRp,8,&boardlines);
  1094.  
  1095. /* Put in text and horizontal lines for board */
  1096.  
  1097.    Move(BdRp,TEXTL,TEXTT+2);
  1098.    Text(BdRp,textline[0],strlen(textline[0]) );
  1099.  
  1100.  
  1101.    for(count = 1; count<MAXLINES;count++) {
  1102.       if(*textline[count] == ' '){
  1103.          Move(BdRp,1,(count*HLINS)+HLINT);
  1104.          Draw(BdRp,HLINR,(count*HLINS)+HLINT);
  1105.          }
  1106.  
  1107.       else{
  1108.          Move(BdRp,TEXTL,(count*TEXTS)+TEXTT);
  1109.          Text(BdRp,textline[count],strlen(textline[count]) );
  1110.  
  1111.          for (column = 0; column < MAXPLAYERS; column ++)
  1112.             {
  1113.             ClearRow(count-2,column);
  1114.             ShowDots(count-2,column);
  1115.             }   /* for columns */
  1116.   
  1117.  
  1118.        }   /* else */
  1119.  
  1120.       };   /* for count */
  1121.  
  1122.  
  1123. /* Draw vertical lines for board */
  1124.  
  1125.    for(count = 0; count<MAXPLAYERS;count++) {   /* replace this with RectFill */
  1126.       Move(BdRp,(count*VLINS)+VLINL+1,VLINT);
  1127.       Draw(BdRp,(count*VLINS)+VLINL+1,VLINB);
  1128.       Move(BdRp,(count*VLINS)+VLINL,VLINT);
  1129.       Draw(BdRp,(count*VLINS)+VLINL,VLINB);
  1130.       }
  1131.  
  1132. /* Blank players names */ 
  1133.    SetDrMd(BdRp,JAM2);
  1134.    for (count=0;count<MAXPLAYERS;count++)
  1135.       {
  1136.       Move(BdRp, DOTL - (2*SPACEW) + (DOTS*count), TEXTT+2);
  1137.       Text(BdRp, "        ", 8);
  1138.       }
  1139.  
  1140. /* Draw initial die images */
  1141.    for(count = 0; count <5 ;count++){
  1142.    DrawImage (BdRp, &Blank, BLANKL, (BLANKS*count) + BLANKT);
  1143.    DrawImage (BdRp, &DieImage[5], BLANKL, (BLANKS*count) + BLANKT);
  1144.    }
  1145.  
  1146.  
  1147.  
  1148. /* use time to seed random number generator */
  1149. CurrentTime(&Seconds,&Micros);
  1150. srand(Micros);
  1151.  
  1152. }   /* end of init_pad */
  1153.  
  1154. InitImages()
  1155. {
  1156.    extern USHORT (*SpotData_chip)[57];
  1157.    int row,col;
  1158.  
  1159.    if ((SpotData_chip = (USHORT (*)[57]) AllocMem(sizeof(SpotData),MEMF_CHIP))   == 0) return(FALSE);   /* allocate chip memory for images */
  1160.  
  1161.    row = 0;
  1162.    while (row < 6)
  1163.    {
  1164.       for (col=0 ; col < 57 ;col++){
  1165.             SpotData_chip[row][col] = SpotData[row][col];
  1166.             }
  1167.       DieImage[row].ImageData = SpotData_chip[row++];
  1168.    }   
  1169.  
  1170.  
  1171.    return(TRUE);
  1172.  
  1173. }
  1174.  
  1175. FreeImages()
  1176. {
  1177. extern USHORT (*SpotData_chip)[57];
  1178.  
  1179.    if (SpotData_chip != 0){
  1180.       FreeMem(SpotData_chip, sizeof(SpotData));
  1181.       }
  1182.  
  1183. }
  1184.  
  1185. Cleanup()
  1186. {
  1187.    FreeImages();
  1188.    CloseWindow(BdWdw);
  1189.    CloseScreen(BdScr);
  1190. }
  1191.  
  1192. /* *********************** program ends here ****************** */
  1193.